﻿using MCPlatform.MotionLib.Base;
using MCPlatform.MotionLib.Base.AssitantClass;
using MCPlatform.UI.Controls.AssistantMethods.StaticMethods;
using Panuon.WPF;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;


namespace MCPlatform.UI.Controls.Models
{
    public class MotionModel : NotifyPropertyChangedBase,INameProvider
    {
        #region Properties
        public IMotion? MotionEntity { get => _MotionEntity; set => Set(ref _MotionEntity, value); }
        private IMotion? _MotionEntity;

        /// <summary>
        /// 轴名称
        /// </summary>

        public string ControlName
        {
            get => _ControlName;
            set
            {
                Set(ref _ControlName, value);

            }
        }

        private string _ControlName = string.Empty;

        //public string? AxisName
        //{
        //    get => _AxisName;
        //    set => Set(ref _AxisName, value);
        //}
        //private string? _AxisName;

        public ushort MotionID
        {
            get => _MotionID;
            set => Set(ref _MotionID, value);
        }
        private ushort _MotionID;

        public double ActualPosition
        {
            get => _ActualPosition;
            set => Set(ref _ActualPosition, value);
        }
        private double _ActualPosition;


        public double ActualVelocity
        {
            get => _ActualVelocity;
            set => Set(ref _ActualVelocity, value);
        }
        private double _ActualVelocity;


        public ushort ErrorID
        {
            get => _ErrorID;
            set => Set(ref _ErrorID, value);
        }
        private ushort _ErrorID;

        public string? ErrorMessage
        {
            get => _ErrorMessage;
            set => Set(ref _ErrorMessage, value);
        }
        private string? _ErrorMessage;

        public bool IsMoving
        {
            get => _IsMoving;
            set => Set(ref _IsMoving, value);
        }
        private bool _IsMoving;

        public bool IsDone
        {
            get => _IsDone;
            set => Set(ref _IsDone, value);
        }
        private bool _IsDone;


        public bool IsError
        {
            get => _IsError;
            set => Set(ref _IsError, value);
        }
        private bool _IsError;

        public bool IsPLimit
        {
            get => _IsPLimit;
            set => Set(ref _IsPLimit, value);
        }
        private bool _IsPLimit;

        public bool IsHome
        {
            get => _IsHome;
            set => Set(ref _IsHome, value);
        }
        private bool _IsHome;

        public bool IsNLimit
        {
            get => _IsNLimit;
            set => Set(ref _IsNLimit, value);
        }
        private bool _IsNLimit;
        public bool IsSPLimit
        {
            get => _IsSPLimit;
            set => Set(ref _IsSPLimit, value);
        }
        private bool _IsSPLimit;

        public bool IsEMG
        {
            get => _IsEMG;
            set => Set(ref _IsEMG, value);
        }
        private bool _IsEMG;

        public bool IsSNLimit
        {
            get => _IsSNLimit;
            set => Set(ref _IsSNLimit, value);
        }
        private bool _IsSNLimit;


        public bool IsEnabled
        {
            get => _IsEnabled;
            set => Set(ref _IsEnabled, value);
        }
        private bool _IsEnabled;


        public double SetVelocity
        {
            get => _SetVelocity;
            set => Set(ref _SetVelocity, value);
        }
        private double _SetVelocity = 5;


        public double SetPositon
        {
            get => _SetPositon;
            set => Set(ref _SetPositon, value);
        }
        private double _SetPositon;


        public double SetDistance
        {
            get => _SetDistance;
            set => Set(ref _SetDistance, value);
        }
        private double _SetDistance;

        public double SetHomeVelocity
        {
            get => _SetHomeVelocity;
            set => Set(ref _SetHomeVelocity, value);
        }
        private double _SetHomeVelocity;





        #endregion

        #region Methods

        public void Mapping()
        {
            if (MotionEntity is null) { return; }
            CommonUse.AutoMapProperties(MotionEntity,this);
        }

        #endregion

    }
}
